.class public Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;
.super Landroid/widget/ArrayAdapter;
.source "ViewFavorites.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/android/glympse/ViewFavorites;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x4
    name = "TicketAdapter"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/widget/ArrayAdapter",
        "<",
        "Lcom/glympse/platform/common/Ticket;",
        ">;"
    }
.end annotation


# instance fields
.field private m_oLayoutInflater:Landroid/view/LayoutInflater;

.field final synthetic this$0:Lcom/glympse/android/glympse/ViewFavorites;


# direct methods
.method public constructor <init>(Lcom/glympse/android/glympse/ViewFavorites;Landroid/content/Context;Lcom/glympse/platform/GVector$Tickets;)V
    .locals 1
    .parameter
    .parameter "oContext"
    .parameter

    .prologue
    .line 178
    .local p3, listTickets:Lcom/glympse/platform/GVector$Tickets;,"Lcom/glympse/platform/GVector$Tickets;"
    iput-object p1, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    .line 176
    const/4 v0, 0x0

    invoke-direct {p0, p2, v0, p3}, Landroid/widget/ArrayAdapter;-><init>(Landroid/content/Context;ILjava/util/List;)V

    .line 171
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->m_oLayoutInflater:Landroid/view/LayoutInflater;

    .line 177
    invoke-static {p2}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    iput-object v0, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->m_oLayoutInflater:Landroid/view/LayoutInflater;

    return-void
.end method


# virtual methods
.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 12
    .parameter "nPosition"
    .parameter "oView"
    .parameter "oParent"

    .prologue
    .line 184
    if-nez p2, :cond_0

    .line 187
    iget-object v7, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->m_oLayoutInflater:Landroid/view/LayoutInflater;

    const v8, 0x7f03000f

    const/4 v9, 0x0

    const/4 v10, 0x0

    invoke-virtual {v7, v8, v9, v10}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object p2

    .line 191
    :cond_0
    iget-object v7, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    iget-boolean v7, v7, Lcom/glympse/android/glympse/ViewFavorites;->m_fExpanded:Z

    if-eqz v7, :cond_2

    const v7, 0x7f020029

    :goto_0
    invoke-virtual {p2, v7}, Landroid/view/View;->setBackgroundResource(I)V

    .line 194
    if-ltz p1, :cond_1

    invoke-virtual {p0}, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->getCount()I

    move-result v7

    if-lt p1, v7, :cond_3

    .line 196
    :cond_1
    const-string v7, "getView() called with out of range position"

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 289
    .end local p1
    :goto_1
    return-object p2

    .line 191
    .restart local p1
    :cond_2
    const v7, 0x7f020028

    goto :goto_0

    .line 201
    :cond_3
    invoke-virtual {p0, p1}, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/glympse/platform/common/Ticket;

    .line 204
    .local v4, oTicket:Lcom/glympse/platform/common/Ticket;
    const v7, 0x7f0c001d

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    .end local p1
    check-cast p1, Landroid/widget/TextView;

    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_strName:Ljava/lang/String;

    invoke-static {p1, v7}, Lcom/glympse/android/glympse/Glympse;->SetTextIfChanged(Landroid/widget/TextView;Ljava/lang/String;)Z

    .line 207
    const v7, 0x7f0c0043

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v5

    .line 208
    .local v5, oViewName:Landroid/view/View;
    new-instance v7, Lcom/glympse/android/glympse/ViewFavorites$OnClickedSend;

    iget-object v8, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    const/4 v9, 0x0

    invoke-direct {v7, v8, v4, v9}, Lcom/glympse/android/glympse/ViewFavorites$OnClickedSend;-><init>(Lcom/glympse/android/glympse/ViewFavorites;Lcom/glympse/platform/common/Ticket;Lcom/glympse/android/glympse/ViewFavorites$OnClickedSend;)V

    invoke-virtual {v5, v7}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 211
    iget-object v7, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    iget-boolean v7, v7, Lcom/glympse/android/glympse/ViewFavorites;->m_fExpanded:Z

    if-nez v7, :cond_4

    .line 213
    const v7, 0x7f0c0044

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    const/16 v8, 0x8

    invoke-static {v7, v8}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    goto :goto_1

    .line 219
    :cond_4
    const v7, 0x7f0c004f

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    new-instance v8, Lcom/glympse/android/glympse/ViewFavorites$OnClickedRename;

    iget-object v9, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    const/4 v10, 0x0

    invoke-direct {v8, v9, v4, v10}, Lcom/glympse/android/glympse/ViewFavorites$OnClickedRename;-><init>(Lcom/glympse/android/glympse/ViewFavorites;Lcom/glympse/platform/common/Ticket;Lcom/glympse/android/glympse/ViewFavorites$OnClickedRename;)V

    invoke-virtual {v7, v8}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 220
    const v7, 0x7f0c0050

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    new-instance v8, Lcom/glympse/android/glympse/ViewFavorites$OnClickedShortcut;

    iget-object v9, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    const/4 v10, 0x0

    invoke-direct {v8, v9, v4, v10}, Lcom/glympse/android/glympse/ViewFavorites$OnClickedShortcut;-><init>(Lcom/glympse/android/glympse/ViewFavorites;Lcom/glympse/platform/common/Ticket;Lcom/glympse/android/glympse/ViewFavorites$OnClickedShortcut;)V

    invoke-virtual {v7, v8}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 221
    const v7, 0x7f0c0051

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    new-instance v8, Lcom/glympse/android/glympse/ViewFavorites$OnClickedDelete;

    iget-object v9, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->this$0:Lcom/glympse/android/glympse/ViewFavorites;

    const/4 v10, 0x0

    invoke-direct {v8, v9, v4, v10}, Lcom/glympse/android/glympse/ViewFavorites$OnClickedDelete;-><init>(Lcom/glympse/android/glympse/ViewFavorites;Lcom/glympse/platform/common/Ticket;Lcom/glympse/android/glympse/ViewFavorites$OnClickedDelete;)V

    invoke-virtual {v7, v8}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 223
    const v7, 0x7f0c0048

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/LinearLayout;

    .line 224
    .local v1, oLayoutMessage:Landroid/widget/LinearLayout;
    const v7, 0x7f0c0049

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/LinearLayout;

    .line 225
    .local v0, oLayoutDestination:Landroid/widget/LinearLayout;
    const v7, 0x7f0c004c

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/TableLayout;

    .line 228
    .local v3, oTableRecipients:Landroid/widget/TableLayout;
    const v7, 0x7f0c0047

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    .line 229
    iget v7, v4, Lcom/glympse/platform/common/Ticket;->m_nDurationMs:I

    if-nez v7, :cond_5

    const-string v7, "0 minutes (Check-in)"

    .line 228
    :goto_2
    invoke-static {p1, v7}, Lcom/glympse/android/glympse/Glympse;->SetTextIfChanged(Landroid/widget/TextView;Ljava/lang/String;)Z

    .line 232
    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_strMessage:Ljava/lang/String;

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_6

    .line 234
    const/16 v7, 0x8

    invoke-static {v1, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    .line 243
    :goto_3
    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_oDestination:Lcom/glympse/platform/common/Place;

    iget-object v7, v7, Lcom/glympse/platform/common/Place;->m_strName:Ljava/lang/String;

    invoke-static {v7}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_7

    .line 245
    const/16 v7, 0x8

    invoke-static {v0, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    .line 254
    :goto_4
    invoke-virtual {v3}, Landroid/widget/TableLayout;->removeAllViews()V

    .line 257
    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_listRecipients:Lcom/glympse/platform/GVector$Recipients;

    invoke-virtual {v7}, Lcom/glympse/platform/GVector$Recipients;->isEmpty()Z

    move-result v7

    if-nez v7, :cond_9

    .line 260
    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_listRecipients:Lcom/glympse/platform/GVector$Recipients;

    invoke-virtual {v7}, Lcom/glympse/platform/GVector$Recipients;->iterator()Ljava/util/Iterator;

    move-result-object v7

    :goto_5
    invoke-interface {v7}, Ljava/util/Iterator;->hasNext()Z

    move-result v8

    if-nez v8, :cond_8

    .line 275
    const v7, 0x7f0c004b

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    const/4 v8, 0x0

    invoke-static {v7, v8}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    .line 276
    const/4 v7, 0x0

    invoke-static {v3, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    .line 287
    :goto_6
    const v7, 0x7f0c0044

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    const/4 v8, 0x0

    invoke-static {v7, v8}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    goto/16 :goto_1

    .line 229
    :cond_5
    iget v7, v4, Lcom/glympse/platform/common/Ticket;->m_nDurationMs:I

    int-to-long v7, v7

    const/4 v9, 0x0

    invoke-static {v7, v8, v9}, Lcom/glympse/platform/common/Helpers;->DurationToLongStr(JZ)Ljava/lang/String;

    move-result-object v7

    goto :goto_2

    .line 238
    :cond_6
    const v7, 0x7f0c0025

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_strMessage:Ljava/lang/String;

    invoke-static {p1, v7}, Lcom/glympse/android/glympse/Glympse;->SetTextIfChanged(Landroid/widget/TextView;Ljava/lang/String;)Z

    .line 239
    const/4 v7, 0x0

    invoke-static {v1, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    goto :goto_3

    .line 249
    :cond_7
    const v7, 0x7f0c004a

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    iget-object v7, v4, Lcom/glympse/platform/common/Ticket;->m_oDestination:Lcom/glympse/platform/common/Place;

    iget-object v7, v7, Lcom/glympse/platform/common/Place;->m_strName:Ljava/lang/String;

    invoke-static {p1, v7}, Lcom/glympse/android/glympse/Glympse;->SetTextIfChanged(Landroid/widget/TextView;Ljava/lang/String;)Z

    .line 250
    const/4 v7, 0x0

    invoke-static {v0, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    goto :goto_4

    .line 260
    :cond_8
    invoke-interface {v7}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/glympse/platform/common/Recipient;

    .line 262
    .local v2, oRecipient:Lcom/glympse/platform/common/Recipient;
    iget-object v8, p0, Lcom/glympse/android/glympse/ViewFavorites$TicketAdapter;->m_oLayoutInflater:Landroid/view/LayoutInflater;

    const v9, 0x7f030010

    const/4 v10, 0x0

    const/4 v11, 0x0

    invoke-virtual {v8, v9, v10, v11}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v6

    .line 265
    .local v6, oViewRecipient:Landroid/view/View;
    const v8, 0x7f0c0052

    invoke-virtual {v6, v8}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/ImageView;

    invoke-static {v2}, Lcom/glympse/android/glympse/Glympse;->GetRecipientImage(Lcom/glympse/platform/common/Recipient;)I

    move-result v8

    invoke-virtual {p1, v8}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 268
    const v8, 0x7f0c0053

    invoke-virtual {v6, v8}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object p1

    check-cast p1, Landroid/widget/TextView;

    invoke-virtual {v2}, Lcom/glympse/platform/common/Recipient;->GetDisplayText()Ljava/lang/String;

    move-result-object v8

    invoke-static {p1, v8}, Lcom/glympse/android/glympse/Glympse;->SetTextIfChanged(Landroid/widget/TextView;Ljava/lang/String;)Z

    .line 272
    new-instance v8, Landroid/widget/LinearLayout$LayoutParams;

    const/4 v9, -0x1

    const/4 v10, -0x2

    invoke-direct {v8, v9, v10}, Landroid/widget/LinearLayout$LayoutParams;-><init>(II)V

    .line 271
    invoke-virtual {v3, v6, v8}, Landroid/widget/TableLayout;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    goto/16 :goto_5

    .line 282
    .end local v2           #oRecipient:Lcom/glympse/platform/common/Recipient;
    .end local v6           #oViewRecipient:Landroid/view/View;
    :cond_9
    const v7, 0x7f0c004b

    invoke-virtual {p2, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    const/16 v8, 0x8

    invoke-static {v7, v8}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    .line 283
    const/16 v7, 0x8

    invoke-static {v3, v7}, Lcom/glympse/android/glympse/Glympse;->SetVisibilityIfChanged(Landroid/view/View;I)Z

    goto/16 :goto_6
.end method
